package ch.unisi.inf.gui;

import java.awt.Event;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

import ch.unisi.inf.engine.Image;
import ch.unisi.inf.gui.action.*;

public class MenuBar extends JMenuBar {
	final JMenu infoMenu;
	final JMenu fileMenu;
	final JMenu editMenu;
	final JMenu windowMenu;
	final JMenu helpMenu;
//	final Image image;
	//private MainFrame frame;// HCODE
	
	
	public MenuBar(){// HCODE
		//this.frame = frame;// HCODE
		
		infoMenu = new JMenu("FM");
		infoMenu.setMnemonic('I');
		fileMenu = new JMenu("File");
		fileMenu.setMnemonic('F');
		editMenu = new JMenu("Edit");
		editMenu.setMnemonic('E');
		windowMenu = new JMenu("Window");
		editMenu.setMnemonic('W');
		helpMenu = new JMenu("Help");
		helpMenu.setMnemonic('H');
		
		// items into fileMenu
		this.add(infoMenu);
		this.add(fileMenu);
		this.add(editMenu);
		this.add(windowMenu);
		this.add(helpMenu);
		
		
		final JMenuItem about = new JMenuItem(new AboutAction());
		final JMenuItem quit = new JMenuItem();//new QuitAction(null));
		quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.META_MASK));
		
		final JMenuItem open = new JMenuItem(new OpenAction());
		open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.META_MASK));
		final JMenuItem print = new JMenuItem(new PrintAction());
		print.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.META_MASK));
		

		final JMenuItem mail = new JMenuItem(new MailAction(null));
		mail.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, Event.META_MASK));
		
		final JMenuItem minimise = new JMenuItem(new MinimiseAction(NewFrame.frame));
		minimise.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, Event.META_MASK));
		
		final JMenuItem help = new JMenuItem(new HelpAction());
		help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, Event.META_MASK));
		
		// menus taken the item
		infoMenu.add(about);
		infoMenu.add(quit);
		fileMenu.add(open);
		fileMenu.add(print);
		//fileMenu.add(mail);
		windowMenu.add(minimise);
		helpMenu.add(help);
		
		
	}

}
